﻿#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
struct ListNode {
 	int val;
 	struct ListNode *next;
 	ListNode(int x) : val(x), next(nullptr) {}
};
struct Compare {
    bool operator()(ListNode*& a, ListNode*& b) {
        return a->val > b->val; // 这里改变比较方式，反转为升序
    }
};
class Solution {
public:
    ListNode* deleteDuplicates(ListNode* head) {
        // write code here
        if (head == nullptr) return nullptr;
        ListNode* pre = head->next;
        ListNode* cur = head;
        while (pre)
        {
            if (pre->val == cur->val)
            {
                cur->next = pre->next;
                delete pre;
                pre = cur->next;
            }
            else {
                cur = pre;
                pre = cur->next;
            }
        }
        return head;
    }
};

int main()
{
    return 0;
}